<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start();
class MY_Controller extends CI_Controller {
    protected $data=array();
    function __construct()
    {
        parent::__construct();
        if($this->session->userdata('logged_in'))
        {   
          $data = array();  
          $session_data = $this->session->userdata('logged_in');
          $data['username'] = $session_data['username']; 
          $data['js'] = 'jQuery.js';
          $data['css'] = 'style.css';
          $this->data = $data;
        }
        else
        {
          //If no session, redirect to login page
          redirect('login', 'refresh');
        }
    }
}
?>